|
|
|
|
|
|
|
Figure 19.4
Some controls placed on a form do
not allow the picture to show through. |
|
|
|
|
|
|
|
|
For example, you can display a product's picture and then, by using the Print method, overlay the price or other database information on top of the picture. This capability is available with the PictureBox control as well but is not available with the Image control. |
|
|
|
|
| |
|
|
|
|
Placing a graphic image directly on a form is an excellent way to provide a texture or background image behind the rest of the form's objects. |
|
|
|
|
|
|
|
|
|
|
Placing the picture directly on the form does, however, have several drawbacks, including the following: |
|
|
|
|
|
|
|
|
You cannot hide the picture; it can only be loaded or unloaded. |
|
|
|
|
|
|
|
|
You cannot control the placement of the picture on the form. |
|
|
|
|
|
|
|
|
You can place only one picture at a time on the form. |
|
|
|
|
|
|
|
|
You cannot resize the picture. It's placed on the form in its original (saved) size. |
|
|
|
|
|
|
|
|
You can overcome these drawbacks by using the Picture or Image control. |
|
|
|
|
|
|
|
|
Using an Image control to display pictures provides a frame for the picture, allowing you to position it anywhere on the form. Another advantage is that the Image control can not only display pictures, but it also can resize them. The Stretch property determines whether the Image control is sized to fit the picture or the picture is sized to fit the control as drawn. If the Stretch property is set to False (the default), the Image control is automatically resized to fit the picture you assign to it. If the Stretch property is set to True, the picture is automatically resized so that the entire picture fits within the current boundaries of the Image control. |
|
|
|
|
|